<?php
include '../controller/company_controller.php';
include '../controller/salarie_controller.php';
class formulaire_societe
{
    function create_societe()
    {
        ?>
        <form method="post" action="../controller/Create_company_Controller.php">
            <h1> Cr&eacute;ation d'une soci&eacute;t&eacute;</h1>
            <label>Nom : </label>
            <input type='text' name='name' value=''><br>
            <label>Siret : </label>
            <input type='text' name='siret' value=''><br>
            <label>Adresse : </label>
            <input type='text' name='adresse' value=''><br>
            <input type='submit' name='enregistrer'>
        </form>
        <?php
    }
    
    function modif_societe()
    {
        $affiche = new company_controller();
        $societe = $affiche->affiche_societe();
        
        ?>
        <form method="post" action="../controller/Create_company_Controller.php?modif=<?php echo $_GET['modif']?>&id_insert=<?php echo $_GET['id_insert']?>">
            <h1> Cr&eacute;ation d'une soci&eacute;t&eacute;</h1>
            <label>Nom : </label>
            <input type='text' name='name' value=<?php echo $societe['nom'];?>><br>
            <label>Siret : </label>
            <input type='text' name='siret' value=<?php echo $societe['siret'];?>><br>
            <label>Adresse : </label>
            <?php echo '<input type="text" name="adresse" value="' . $societe['adresse'] . '"><br>';?>
            <input type='submit' name='modif' value='enregistrer'>
            <input type='submit' name='salarie' value="salarie">
        </form>
        <?php
    }
    
    function affiche_salarie()
    {
    $salarie = new salarie_controller();
    $tableau_salarie = $salarie->liste_salarie("salarie",$_GET['id_insert'])
    ?>
        <h2> Liste des salari&eacute;</h2>
        <?php
            foreach ($tableau_salarie as $value) 
            {
                echo "<label>".$value."</label><br>";
            }
    }
}
?>
